import java.util.Random;

/**
 * 
 */

/**
 * Class that generates vehicles
 * @author jmaria_iturbe
 *
 */
public class Vehicle {
	
	protected String name;
	protected int speed;
	protected int acceleration;
	protected int grip;
	
	/**
	 * Default constructor
	 * @param name
	 * @param speed
	 * @param acceleration
	 * @param grip
	 */
	public Vehicle(String name, int speed, int acceleration, int grip) {
		this.name = name;
		this.speed = speed;
		this.acceleration = acceleration;
		this.grip = grip;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the speed
	 */
	public int getSpeed() {
		return speed;
	}

	/**
	 * @param speed the speed to set
	 */
	public void setSpeed(int speed) {
		this.speed = speed;
	}

	/**
	 * @return the acceleration
	 */
	public int getAcceleration() {
		return acceleration;
	}

	/**
	 * @param acceleration the acceleration to set
	 */
	public void setAcceleration(int acceleration) {
		this.acceleration = acceleration;
	}

	/**
	 * @return the grip
	 */
	public int getGrip() {
		return grip;
	}

	/**
	 * @param grip the grip to set
	 */
	public void setGrip(int grip) {
		this.grip = grip;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Vehicle [name=" + name + ", speed=" + speed + ", acceleration="
				+ acceleration + ", grip=" + grip + "]";
	}
	
	/**
	 * Method to start the 3 attributes with random values
	 */
	public void start() {
		Random random = new Random();
		for (int i =0; i<17; i++){
			int rndvalue = random.nextInt(3);
			if (rndvalue == 0) {speed = speed+1;};
			if (rndvalue == 1) {acceleration = acceleration+1;};
			if (rndvalue == 2) {grip = grip+1;};
		}
		
	}
	
	/**
	 * Method to move the vehicle
	 * @return
	 */
	public int move() {
		Random random = new Random();
		int result = 0;
		int rndvalue = random.nextInt(6);
		result = speed + acceleration + rndvalue;
		return result;
	}
	
	/**
	 * Method to maneuver the vehicle
	 * @return
	 */
	public int maneuver(){
		Random random = new Random();
		int result = 0;
		int rndvalue = random.nextInt(6);
		result = grip + rndvalue;
		return result;
	}
	
}
